<%@page language="java" pageEncoding="UTF-8"%>    
<%@page contentType="text/html; charset=UTF-8"%>
<%@page import="java.net.*" %>
<%@page import="net.ssta.common.LoginUser"%>
<%@page import="net.ssta.core.db.RecordSet"%>
<%@page import="net.ssta.core.db.Record"%>
<%@page import="java.sql.Connection"%>
<%@page import="net.ssta.core.db.DBConnectionProvider"%>
<%@page import="net.ssta.core.db.DataBaseExecutor"%>
<%@page import="net.ssta.common.Constants"%>


<%        
  		String path = request.getContextPath();
  		response.setHeader("ContentType","text/xml");  
        response.setHeader("Pragma","No-Cache");   
        response.setDateHeader("Expires",0);   
        response.setHeader("Cache-Control","No-Cache");  
%>

<%  
	//request.setCharacterEncoding("gbk");
	
	String userid = LoginUser.getUserId();
	String expid = request.getParameter("expid");
        if(expid == null ) expid="";
        String title = request.getParameter("title");
    
    Connection conn = null;
    conn = DBConnectionProvider.getConnection(Constants.JNDI_SSTA);
    DataBaseExecutor m_executor = DataBaseExecutor.getExecutor(conn);
    
    String sqlstr = "select * from  T_Expert where  ExpertID = '"+expid+"'";
    
    RecordSet rcdSet = new RecordSet();
	rcdSet.add(m_executor.find(sqlstr));
	
	Record expRecord = new Record();
	if(rcdSet!=null&&rcdSet.size()>0){
		expRecord = rcdSet.get(0);
	}
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>   
<!--  <meta http-equiv="Content-Type" content="text/html; charset=gbk" />-->
<title>行业专家－国家安科网</title>
<!-- 
<link rel="stylesheet" type="text/css" href="css/style.css" />
<link rel="stylesheet" type="text/css" href="../common/css/style.css" />
 -->
 <link href="<%=path%>/common/css/layout.css" rel="stylesheet" type="text/css" />
<link href="<%=path%>/common/css/user.css" rel="stylesheet" type="text/css" />
   
<script language = "javascript" src = "../common/js/list.js" type = "text/javascript"></script>
<script language = "javascript" src = "../common/js/pool.js" type = "text/javascript"></script>
<script language = "javascript" src = "../common/js/page.js" type = "text/javascript"></script>
<script language = "javascript" src = "../common/js/check.js" type = "text/javascript"></script>
<script language = "javascript" src = "../common/js/log.js" type = "text/javascript"></script>
<script language = "javascript" src = "../common/js/message.js" type = "text/javascript"></script>
<script language = "javascript" src = "js/search.js" type = "text/javascript"></script>
<script language = "javascript" src = "js/setcondition.js" type = "text/javascript"></script>
<script language = "javascript" src = "../common/js/mycollection.js" type = "text/javascript"></script>
<script language = "javascript" src = "../common/js/g_variables.js" type = "text/javascript"></script>

<script type="text/javascript" src="<%=path %>/includes/FileUpload/fileUpload.js"></script>


<script type='text/javascript' src="<%=path%>/includes/js/jquery.js"></script>

<xml id="resultDom"></xml>

<style>
	body,html{ 
    margin:0 auto;
	font-size:12px;
	text-align:center;
	background:none;
	background-repeat:repeat-x;
}
</style>
</head>
<script>
	var fPath = "http://" + location.host + "/SSTA/expert/";
	var dg = frameElement.dg;
	//dg.addBtn('save', '保存', save);
	//dg.addBtn('cancel', '取消', closeWindow);
	
	
	

	/*第二个上传组件*/
	//上传组件参数初始化
	var settingP={
				id:"FileUploadP",
				swfPath:"<%=path%>/includes/FileUpload/FileUploadForHr.swf",
				serverPath:"<%=path%>/back/FileUploadManagerServlet?method=savePhoto&expid=<%=expid%>",
				imgPath:"<%=path%>/includes/FileUpload/upload.jpg",
				width:70,
				height:20,
			 	fileSize:"100",
			 	fileType:"*.jpg",
				noFileType:"*.exe,*.doc,*.docx,*.txt,*.rar,*.xls,*.xlsx,*.ppt,*.pptx,*.bat,*.html,*.db,*.zip",
			 	checkAndUploadExtend:checkAndUploadExtendP,
			 	uploadCompleteExtend:uploadCompleteExtendP
				};
			
	/*上传文件有效性判断*/
	function checkAndUploadExtendP(id,serverJson)
	{
		//如果你想获取当前上传组件参数的话
		//var parameters=FU.getSettingById[id];
		if(serverJson.checkType=="all"){
			//各种校验通过,如果你想在文件正式上传前做点什么的话，你就在这做吧！
			$("#fileInfo").html(serverJson.fileName);
			$("#json1").html(FU.jsonToStr(serverJson));
		}else if(serverJson.checkType=="suffix"){
			//文件后缀名有误
			alert("请上传后缀名为.jpg的照片");
		}else if(serverJson.checkType=="noSuffix"){
			//不允许的后缀名出错
			//alert("不允许的后缀名有误1");
			alert("请上传后缀名为jpg、png的照片文件"); //modify by ante 修复bug，上传照片文件格式错误时提示的信息 2011-12-08 
		}else if(serverJson.checkType=="size"){
			//文件大小有误
			alert("文件大小有误1");
		}
	}
	
	/*文件上传成功后，将服务器返回值返回到页面*/
	function uploadCompleteExtendP(id,serverJson)
	{
		//如果你想在文件上传结束后做点什么的话，你就在这做吧！
		var imageObj= eval("(" + serverJson + ")");
		var filename = imageObj.fileName;
		var filepath = imageObj.imgPath;
		var fileid = imageObj.id;
		
		
		//页面读取大照片的url
		var imagurl = '<%=path%>/expert/image/photo/<%=expid%>.jpg';
		
	    //photoHtml = "<img id=\"img_photo\" src=\""+imagurl+"\" style=\"border:4px solid #A8B1B2;margin-top:1px;\" width=\"92px\" height=\"100px\" />";
		//$("#photoDiv").html("aa.jpg2");
		
		$("#img_photo").attr("src","aa.jpg2");
		alert('上传照片成功!');
		$("#img_photo").attr("src",imagurl);
		
		
		//$("#photoDiv").html(photoHtml);
		
		window.location.reload();
		
		var str = "<img style=\"cursor:pointer;\" src=\"<%=path%>/common/images/del.gif\" onclick=\"imgDelPhoto(\'<%=expid%>.jpg\')\" />";
		$("#delImgDiv").html(str);
	}

	
	
	function imgDelPhoto(savePath)
	{
		if(confirm("您确定要删除该专家的照片吗？"))
		{
			delPhoto(savePath);
			
			//删除照片
			$("#img_photo").attr("src","<%=path%>/common/images/no_photo.png");
			$("#delImgDiv").html("");
		}
	}
	
	
	function delPhoto(savePath)
	{
	    $.ajax({
			type: "POST", url: "<%=path%>/back/FileUploadManagerServlet?method=delImage&filePath="+savePath,
			data:$("#form1").serialize(),
			error:function(){alert("与服务器失去联系，请刷新本页面后再重试！");},
			success: function(msg){
				alert("删除照片成功！");
			}
		});
		
		//删除照片
		$("#img_photo").attr("src","<%=path%>/common/images/no_photo.png");
	}
		
	


    $("document").ready(function()
	{
		if($("#img_photo").attr("src")!="<%=path%>/common/images/no_photo.png")
		{
			var str = "<img style=\"cursor:pointer;\" src=\"<%=path%>/common/images/del.gif\" onclick=\"imgDelPhoto(\'<%=expid%>.jpg\')\" />";
			$("#delImgDiv").html(str);
		}
		
	}); 
	
	
	
</script>

<body>



<!--页面主体部分-->
<div id="int_show_con_title"><%=title%></div>
<div id="int_show_con_info">
			    <span></span>
				<span></span>
				<span></span>
				<span></span>
			</div>
<div id="int_show_con_content" style="">
	<span id="zoom" >
       		 <div id="showDetailExpertInfo" style="text-align:left;margin:auto;vertical-align:top;">
				<div style="position:relative;">
					<table style="margin-top:0px;" class="table_info" align="left">
						<tr><td >【性别】男</td></tr>
						<tr><td>【职称】正高</td></tr>
						<tr><td>【文化程度】博士研究生</td></tr>
						<tr><td>【现从事专业】抢险救灾</td></tr>
						<tr><td>【所学专业】机电</td></tr>
						<tr><td>【单位】河南矿山抢险排水救灾中心</td></tr>
						<tr><td>【主要成就】</td></tr>
					</table>
					
					
					<div style="position:absolute; right:61px; top:1px; width:40px; height:50px; ">
						<div id="photoDiv">
								<img id="img_photo" src="<%=path%>/expert/image/photo/<%=expid.trim()%>.jpg" onerror="javascript:this.src='<%=path%>/common/images/no_photo.png'" width="92px" height="100px" style="border:4px solid #A8B1B2;margin-top:1px;"/>
						</div>
						<div>
							<table><tr><td>
							<script>
								FU.iniFlashPlayer(settingP);
							</script>
							</td>
							<td id="delImgDiv">
							</td>
							</tr>
						</div>
					</div>
				</div>
				<div class="blank40"></div>
       		 </div> 	
	</span>
</div>




<form name="collectionform" id="collectionform">
<cms:infobase>
	<input type="hidden" name="channelid" id="channelid" value="13" />
    <input type="hidden" name="channelname" id="channelname" value="科研专家" />
    <input type="hidden" name="infotitle" id="infotitle" value="" />
    <input type="hidden" name="infoid" id="infoid" value="<%=expid%>" />
    <input type="hidden" name="collectionurl" id="collectionurl" value="" />
</cms:infobase>    
</form>

</body>
</html>
